package com.yunxin.server.constant.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.concurrent.TimeUnit;

/**
 * @author zero°
 * @since 2023-06-11
 */
@RequiredArgsConstructor
@Getter
public enum GatewayLockKey {
    /**
     * 创建用户申请单
     */
    ORDER_CREATE_USER_APPLY("distribution:gateway:create:user:apply::", Boolean.FALSE, 10L, 30L, TimeUnit.SECONDS),

    /**
     * 分配用户申请单
     */
    ORDER_ALLOCATION_USER_APPLY("distribution:gateway:allocation:user:apply:", Boolean.FALSE, 10L, 30L, TimeUnit.SECONDS),


    /**
     * 分配单用户微信号更新
     */
    ORDER_UPDATE_ALLOCATION_USER_WECHAT("distribution:gateway:allocation:user:wechat:", Boolean.FALSE, 10L, 30L, TimeUnit.SECONDS),


    /**
     * 用户访问者
     */
    USER_VISITOR("distribution:gateway:user:visitor:", Boolean.FALSE, 10L, 30L, TimeUnit.SECONDS),

    /**
     * 创建uv限流
     */
    UV_ORDER_LIMIT("distribution:gateway:uv:limit", Boolean.FALSE, 2L, 5L, TimeUnit.SECONDS),
    /**
     * 创建uv限流
     */
    UV_ORDER_CREATE("distribution:gateway:uv:create", Boolean.FALSE, 5L, 5L, TimeUnit.SECONDS),

    /**
     * 用户登录
     */
    USER_LOGIN("distribution:gateway:user:login:", Boolean.FALSE, 10L, 30L, TimeUnit.SECONDS),
    ;

//    /**
//     * 创建uv限流
//     */
//    UV_ORDER_LIMIT("distribution:gateway:uv:limit", Boolean.FALSE, 2L, 5L, TimeUnit.SECONDS),





    private final String prefix;
    private final Boolean usePrefixAsFullKey;
    private final long waitTime;
    private final long releaseTime;
    private final TimeUnit timeUnit;
}
